# -- coding: utf-8 -- 
# Name: app

from flask import Flask
import pymysql
pymysql.install_as_MySQLdb()
app = Flask(__name__)
conn = pymysql.Connect(host='127.0.0.1', port=3306, user='root', passwd='123456', db='poc', charset='utf8')
cursor = conn.cursor()
try:
    sql_ins = "insert into user(username,email) values ('yanggyang','123@qq.com')"
    sql_insert = "insert into user(username,email) values ('whoami','1admin@qq.com')"
    cursor.execute(sql_ins)
    cursor.execute(sql_insert)
    conn.commit()
except Exception as e:
    print(e)
conn.rollback()
cursor.close()
conn.close()


@app.route('/')
def hello_world():
    return 'hello world'


if __name__ == '__main__':
    app.run()